// ********************************************************************************************
// Este archivo fuente es propiedad de Feria de Remates S.R.L. de C.V. Prohibida su copia o uso
// sin autorización explícita.
// This source file is propietary to Feria de Remates S.R.L. de C.V. May not be used or copied
// without explicit authorization.
// ********************************************************************************************/
package com.feriaderemates.domain.message;

import java.util.Date;

/**
 * Represents a message sent between two users
 *
 * @author Oscar García
 */
public class Message {

    private final String senderUsername;
    private final String receiverUsername;
    private final String message;
    private final Date date;
    private final String subject;

    private Message(String senderUsername, String receiverUsername, String message, String subject, Date date) {
        this.senderUsername = senderUsername;
        this.receiverUsername = receiverUsername;
        this.subject = subject;
        this.date = date;
        this.message = message;
    }

    private Message(String senderUsername, String receiverUsername, String message, String subject) {
        this.senderUsername = senderUsername;
        this.receiverUsername = receiverUsername;
        this.subject = subject;
        this.date = null;
        this.message = message;
    }

    public static Message createMessageToInsert(String senderId, String receiverId, String message, String subject) {
        return new Message(senderId, receiverId, message, subject);
    }

    public static Message createMessageToShow(String senderId, String receiverId, String message, String subject, Date date) {
        return new Message(senderId, receiverId, message, subject, date);
    }


    /**
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * @return the subject
     */
    public String getSubject() {
        return subject;
    }

    /**
     * @return the senderUsername
     */
    public String getSenderUsername() {
        return senderUsername;
    }

    /**
     * @return the receiverUsername
     */
    public String getReceiverUsername() {
        return receiverUsername;
    }

}
